package cn.gene.timeyan.article.webapi.mapper;


import cn.gene.timeyan.pojo.article.dto.NewArticleDTO;
import cn.gene.timeyan.pojo.article.model.Article;
import cn.gene.timeyan.pojo.article.vo.ArticleVO;
import cn.gene.timeyan.pojo.article.vo.SimpleArticleVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 鏂囩珷淇℃伅 Mapper 接口
 * </p>
 *
 * @author LWG
 * @since 2022-07-25
 */
@Repository
public interface ArticleMapper  {
    // 全查所有分享内容
    List<Article> findAllList();
    Article selectByUserId(Long userId);
    Integer updateArticleLike(Long articleId,Long userId,Integer articleLike);
    Long selectUserId(Long articleId);


    /**
     * 根据帖子id获得帖子全内容
     * @param articleId 帖子id
     * @return 一个帖子类
     */
    Article getArticleByArticleId(Long articleId);

    int updateArticleRetweetedarticleRetweeted(
            @Param("articleId") Long articleId,
            @Param("updateTime") Date updateTime,
            @Param("articleRetweetedarticleRetweeted") Integer articleRetweetedarticleRetweeted );


    Long getUserIdByArticleId(Long articleId);

    ArticleVO getArticleDetailByArticleId(Long articleId);

    int display(String id);

    int hide(String id);

    int updateCommentByCommentId(Long articleId);

    Article getArticleSimpleByArticleId(Long articleId);

    List<SimpleArticleVO> getArticleList(@Param("modelId") Long modelId);

    int updateArticleCountByArticleId(int like, int retweeted, int visit, int collection, int comment, String articleId);

    List<SimpleArticleVO> getArticleListByUserId(Long userId);

    int addNewArticle(NewArticleDTO newArticleDTO);

    Long getArticleIdByUserIdAndTitle(@Param("userId") Long userId,@Param("title") String title);
}
